﻿using MediatR;
using S_UserInfor.Api.Application.Commands;
using S_UserInfor.Infrasturctre.Interface;

namespace S_UserInfor.Api.Application.CommandsHanders
{
    public class UserSqlSuageDelCommandsHanders : IRequestHandler<UserSqlSuageDelCommands, int>
    {
        private readonly IUserRepository _user;

        public UserSqlSuageDelCommandsHanders(IUserRepository user)
        {
            _user = user;
        }
        public async Task<int> Handle(UserSqlSuageDelCommands request, CancellationToken cancellationToken)
        {
            var res = await _user.GetFindAsync(request.Id);
            res.IsDel = true;
            return await _user.UpdateAsync(res);
        }
    }
}
